package com.zly.solon.controller;

import com.zly.solon.entity.User;
import com.zly.solon.mapper.UserMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.solon.annotation.Db;
import org.noear.solon.annotation.*;

@Slf4j
@Mapping("/user")
@Controller
public class UserController {
    @Db(value = "db1")
    private UserMapper userMapper;
    @Get
    @Mapping
    public User find(@Param Integer id) {
        log.info(id.toString());
        return userMapper.getUserById(id);
    }
    @Mapping("/{id}")
    public User findById(@Path Integer id) {
        log.info(id.toString());
        return userMapper.getUserById(id);
    }
}
